<script lang="ts" setup>
import { ref } from "vue"
// import { SysRole } from "@/api/user/type/user"
// import { CascaderOption } from "element-plus"
import { roleAllApi } from "@/api/user/role"

const emits = defineEmits(["fPid"])
const data = ref<any>()

roleAllApi().then((res) => {
  const { code, body } = res
  if (code === 200) {
    data.value = body
  }
})

const change = (op: any) => {
  emits("fPid", op[op.length - 1])
}
</script>

<template>
  <el-cascader
    :options="data"
    @change="change"
    :props="{ checkStrictly: true, label: 'role', value: 'id', children: 'child', multiple: true }"
    clearable
  />
</template>
